package com.hanma.service.impl;

import java.util.List;

import com.hanma.bean.Category;
import com.hanma.dao.CategoryDao;
import com.hanma.dao.UserDao;
import com.hanma.dao.impl.CategoryDaoImpl;
import com.hanma.dao.impl.UserDaoImpl;
import com.hanma.service.CategoryService;

public class CategoryServiceImpl implements CategoryService{

	@Override
	public boolean insert(Category category) {
		CategoryDao dao = new CategoryDaoImpl();
		int num = dao.insert(category);
		if(num>0) {
			return true;
		}
		return false;
	}

	@Override
	public boolean update(Category category) {
		CategoryDao dao = new CategoryDaoImpl();
		int num = dao.update(category);
		if(num>0) {
			return true;
		}
		return false;
	}

	@Override
	public boolean delete(Integer id) {
		CategoryDao dao = new CategoryDaoImpl();
		int num = dao.delete(id);
		if(num>0) {
			return true;
		}
		return false;
	}

	@Override
	public Category find(Integer id) {
		CategoryDao dao = new CategoryDaoImpl();
		return dao.find(id);
	}

	@Override
	public List<Category> findAll(Integer id) {
		CategoryDao dao = new CategoryDaoImpl();
		return dao.findAll(id);
	}

	@Override
	public List<Category> findAllRec() {
		CategoryDao dao = new CategoryDaoImpl();
		return dao.findAllRec();
	}

	@Override
	public List<Category> findAllByState() {
		CategoryDao dao = new CategoryDaoImpl();
		return dao.findAllByState();
	}

}
